package org.example.contronller;

import lombok.RequiredArgsConstructor;
import org.example.pojo.EmailPromotionParam;
import org.example.pojo.Result;
import org.example.service.EmailPromotionService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController//表示交给Spring管理哦
@RequestMapping("/email")//配置映射路径
@RequiredArgsConstructor
public class EmailPromotionController {
    private final EmailPromotionService emailPromotionService;
    //管理员邮件推广
    @PostMapping("/adminPromotion")
    public Result adminPromotion(@Validated @RequestBody EmailPromotionParam emailPromotionParam){
        return Result.success("推广成功",emailPromotionService.adminPromotion(emailPromotionParam));
    }

}
